e[Single]
#ScriptVersion[2]
#Title[UR4]

script_enemy_main{
	
	@Initialize{
		//f[^
		InitializeData();
		Initialize_Fairy( VERYSMALL );
		
		//摜ݒ
		imgBoss = imgFairy_Red;
		
		//Ctݒ
		SetLife( 1 );
		
		//蔻ݒ
		SetCollisionEx( 32, 8, false, 30 );
		
		//C^XNJn
		TMain();
	}
	
	@MainLoop{
		//yield[v
		yield;
	}
	
	@DrawLoop{
		//d摜`
		DrawFairy( imgBoss );
	}
	
	@Finalize{
		//ŏI
		FinalizeData();
	}
	
	/**
	 * C^XN
	 */
	task TMain(){
		//ړ^XN
		MoveTask();
		
		//10F(0.16b)҂
		FWait( 10 );
		
		//U
		alternative( difficult )
			case( "Easy" ){
				Atack_Easy();
			}
			case( "Normal" ){
				Atack_Normal();
			}
			case( "Panic" ){
				Atack_Panic();
			}
	}
	
	/**
	 * Easy UC^XN
	 */
	task Atack_Easy(){
	}
	
	/**
	 * Normal UC^XN
	 */
	task Atack_Normal(){
	}
	
	/**
	 * Panic UC^XN
	 */
	task Atack_Panic(){
		Atack1();
	}
	
	/**
	 * e^XN1
	 */
	task Atack1(){
		let angle = 0;
		
		loop( 5 ){
			angle = rand( -6, 6 );
			ascent( j in 0..7 ){
				CreateShot01( GetX(), GetY(), 5.4 + j * 0.3, GetAngleToPlayer(), US_BALL_S_RED, 0 );
			}
			
			FWait( 8 );
		}
	}
	
	/**
	 * ړ^XN
	 */
	task MoveTask(){
		let angle = GetAngle();
		let lim = 14;
		loop( 40 ){
			angle = AngleSearch( GetX(), GetY(), GetPlayerX(), GetPlayerY(), angle, lim );
			SetAngle( angle );
			lim *= 0.95;
			yield;
		}
		
		FWait( 200 );
		
		//G
		isautodelete = true;
		VanishEnemy();
	}
	
	//XNvg̃CN[h
	#include_function ".\..\..\initialize_zako.txt"
}